package co.edu.usbcali.prototipobeta.modelo.dto;

import co.edu.usbcali.prototipobeta.modelo.Evento;
import co.edu.usbcali.prototipobeta.presentation.backingBeans.EventoView;

import java.io.Serializable;

import java.util.Date;

import javax.faces.event.ActionEvent;


/**
*
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class EventoDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String bebeId_Bebe;
    private String eveId;
    private boolean rowSelected = false;
    private EventoView eventoView;
    private Evento evento;

    public Evento getEvento() {
        return evento;
    }

    public String listener_update(ActionEvent e) {
        try {
            eventoView.action_modifyWitDTO(((eveId == null) ||
                eveId.equals("")) ? null : new Long(eveId),
                ((bebeId_Bebe == null) || bebeId_Bebe.equals("")) ? null
                                                                  : new Long(
                    bebeId_Bebe));
            rowSelected = !rowSelected;
        } catch (Exception ex) {
            return "";
        }

        return "";
    }

    public void listener_cancel(ActionEvent e) {
        eveId = evento.getEveId().toString();
        bebeId_Bebe = (evento.getBebe().getBebeId() != null)
            ? evento.getBebe().getBebeId().toString() : null;
        rowSelected = !rowSelected;
    }

    /**
    * <p>Bound to commandLink actionListener in the ui that renders/unrenders
        * the Object details for editing.</p>
        */
    public void toggleSelected(ActionEvent e) {
        eveId = evento.getEveId().toString();
        bebeId_Bebe = (evento.getBebe().getBebeId() != null)
            ? evento.getBebe().getBebeId().toString() : null;
        rowSelected = !rowSelected;
    }

    public void setEvento(Evento evento) {
        this.evento = evento;
    }

    public EventoView getEventoView() {
        return eventoView;
    }

    public void setEventoView(EventoView eventoView) {
        this.eventoView = eventoView;
    }

    public String getBebeId_Bebe() {
        return bebeId_Bebe;
    }

    public void setBebeId_Bebe(String bebeId_Bebe) {
        this.bebeId_Bebe = bebeId_Bebe;
    }

    public String getEveId() {
        return eveId;
    }

    public void setEveId(String eveId) {
        this.eveId = eveId;
    }

    public boolean isRowSelected() {
        return rowSelected;
    }

    public void setRowSelected(boolean rowSelected) {
        this.rowSelected = rowSelected;
    }
}
